<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fnt" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>WorkWise Html Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="" />
<meta name="keywords" content="" />

	<link rel="stylesheet" type="text/css" href="<%=path%>/web/css/style1/animate.css">

	<link rel="stylesheet" type="text/css" href="<%=path%>/web/css/style1/line-awesome-font-awesome.min.css">
	<link rel="stylesheet" type="text/css" href="<%=path%>/web/css/style1/jquery.mCustomScrollbar.min.css">
	<link rel="stylesheet" type="text/css" href="<%=path%>/web/css/style1/style.css">
	<link rel="stylesheet" type="text/css" href="<%=path%>/web/css/style1/responsive.css">
	<link rel="stylesheet" href="<%=path%>/web/css/style/style2.css" />
	<style>
		#header{
			background-color: #FFF;
		}
	</style>
</head>

<script src="<%=path%>/web/js/jq.js"></script>
<script src="<%=path%>/web/js/jq1.js"></script>
<script src="<%=path%>/web/js/d1.js"></script>
<script src="<%=path%>/web/js/d2.js"></script>

<body>
<jsp:include page="headerandfoter/header.jsp"></jsp:include><!-- 包含头部 -->

	<div class="wrapper">

		<section class="forum-page" style="padding-bottom: 0">
			<div class="container">
				<div class="forum-questions-sec" style="padding-left: 13%">
					<div class="row">
						<div class="col-lg-8">
							<div class="forum-post-view" style="width: 70%;min-height: 400px">
								<div class="usr-question">

									<div class="usr_quest" style="width: 97%">
										<h3 style="padding-bottom: 10px">${knowledge.problem}</h3>
										<span style="margin-bottom: 10px">发布人:${knowledge.admin.adminAccount}</span><br>
										<span style="margin-bottom: 10px">发布时间:<f:formatDate value="${knowledge.time}" pattern="yyyy-MM-dd hh:mm"/></span>
										<ul class="quest-tags" style="margin-top: 0;margin-bottom: 15px">
											<li><a href="#" title="">${knowledge.questionType.name}</a></li>
											<li><a href="#" title="" id="addCollection"><c:if test="${ not isCollection}">收藏</c:if><c:if test="${isCollection}">取消收藏</c:if></a></li>
										</ul>
										<p>${knowledge.answer}</p>
									</div><!--usr_quest end-->
								</div><!--usr-question end-->
							</div><!--forum-post-view end-->
						</div>

					</div>
				</div><!--forum-questions-sec end-->
			</div>
		</section><!--forum-page end-->

		<jsp:include page="headerandfoter/foter.jsp"></jsp:include><!-- 包含头部 -->
	</div><!--theme-layout end-->
<script type="text/javascript" src="<%=path%>/web/js/jquery-2.1.4.min.js"></script>
<script>
	$(function () {
		$("#addCollection").click(addCollection);
	});
	function addCollection() {
		$.get("<%=path%>/services/addCollection",
				{"knowledgeId":${knowledge.id}},
				function (data) {
			if(data=="1"){
				location.href="/services/login";
			}
				if(data=="0"){
					 var content=$("#addCollection").html();
					 if(content=="收藏"){
						 $("#addCollection").html("取消收藏");
					 }
					 if(content=="取消收藏"){
						 $("#addCollection").html("收藏");
					 }
				}
				}
		);
	}
</script>
</body>
</html>